package com.gidgabs.modules.api.controller.my;

import com.gidgabs.common.annotation.LoginUserApi;
import com.gidgabs.common.utils.ReturnJson;
import com.gidgabs.dto.TbUserDto;
import com.gidgabs.dto.TbUserJournalDto;
import com.gidgabs.modules.api.service.my.MyJournalService;
import com.gidgabs.modules.api.service.my.MyUserService;
import com.gidgabs.modules.entity.TbUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by tby on 2018/7/4.
 */
@Api("我的模块-日志")
@RestController
@RequestMapping("api/my")
public class ApiMyJournalController {

    @Autowired private MyJournalService myJournalService;

    @ApiOperation(value = "查询我的日志,按发表时间排序")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "status",value = "日志状态(0未支付,1已支付),为 null时查询所有",dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "页面大小",dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageNo",value = "页码",dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "token",value = "token",dataType = "string",paramType = "header")
    })
    @RequestMapping(value = "journal", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
    public ReturnJson<TbUserJournalDto> queryList(Integer status,Integer pageSize,Integer pageNo) {
        if (pageNo==null){
            pageNo=1;
        }if (pageSize==null){
            pageSize=10;
        }
        return myJournalService.queryList(status,pageSize,pageNo);
    }
}
